package hy.service;

import hy.beans.User;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class UserService {
    List<User> users;
    {
        users= Arrays.asList(new User("1","a1","123"),new User("2","a2","123"));
    }
    public User login(User user) {
        for(User u:users){
            if(u.getName().equals(user.getName())&&u.getPassword().equals(user.getPassword())){
                return u;
            }
        }
        throw new RuntimeException("认证失败");
    }
}